import request from "@/utils/request"
import type { UserInfoResponseData, ResponseData } from "@/types/admin/user"
import type { ImageListResponse } from "@/types/admin/image"
import type { GetCategoryListResponse } from "@/types/admin/category"
import type { GetTagsResponseData } from "@/types/admin/tags"
import type { LogResponse } from "@/types/admin/dashboard"

// 获取网站作者信息
export const getAuthorInfoAPI = () => {
  return request.get<any, UserInfoResponseData>("/web/index/user/info")
}

// 获取轮播图信息
export const getBannerAPI = () => {
  return request.get<any, ImageListResponse>("/web/index/banner/list")
}

// 获取分类列表
export const getCategoryAPI = () => {
  return request.get<any, GetCategoryListResponse>("/web/index/categorys")
}

// 获取文章标签
export const getTagAPI = () => {
  return request.get<any, GetTagsResponseData>("/web/index/tags")
}

// 获取日志列表
export const getJournalAPI = (page: number, pageSize: number) => {
  return request.get<any, LogResponse>(`/web/index/journal?page=${page}&pageSize=${pageSize}`)
}

// 添加网站访问记录
export const addVisitAPI = () => {
  return request.post<any, ResponseData>("/web/index/visit")
}
